package com.zhuchaooasystem.adapter.holder;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.zhuchaooasystem.R;
import com.zhuchaooasystem.entity.ServiceDetailEntity;
import com.zhuchaooasystem.ui.home.service.ServiceDetailActivity;
import com.zhuchaooasystem.utils.CalendarUtils;

/**
 * @author yinsi
 */
public class DetialUnusualHolder extends BaseViewHolder<ServiceDetailEntity.ResultBean.SuccessfulBean.ExceptionModelBean> {
    //----
    private ImageView iv_cover;
    private TextView txt_content;
    private TextView txt_time;
    //----
    private Context mContext;
    private ServiceDetailActivity activity;

    public DetialUnusualHolder(ViewGroup parent, ServiceDetailActivity activity) {
        super(parent, R.layout.item_activity_detail_unusual);
        mContext = getContext();
        this.activity = activity;
        //----
        iv_cover = $(R.id.item_act_detail_unusual_iv_cover);
        txt_content = $(R.id.item_act_detail_unusual_txt_content);
        txt_time = $(R.id.item_act_detail_unusual_txt_time);

    }

    @Override
    public void setData(final ServiceDetailEntity.ResultBean.SuccessfulBean.ExceptionModelBean unusual) {
        //----
        txt_content.setText(unusual.getContent());
        txt_time.setText(CalendarUtils.formatSysMills(unusual.getCreateTime()));
        //----
        Glide.with(mContext).load(unusual.getFilePath())
                .asBitmap().error(R.drawable.ic_image_default).centerCrop().into(iv_cover);

    }

}
